<?php

namespace App\Models\System;

use App\Models\Permission;
use Illuminate\Database\Eloquent\Model;

class Menu extends Model
{
	/**
	 * 定义主键
	 *
	 * @var string
	 * Date: 22/03/2018
	 * @author George
	 */
	protected $primaryKey = 'code';

	/**
	 * 禁用自增
	 *
	 * @var bool
	 * Date: 17/04/2018
	 * @author George
	 */
	public $incrementing = false;

	/**
	 * 禁用时间戳
	 *
	 * @var bool
	 * Date: 17/04/2018
	 * @author George
	 */
	public $timestamps = false;

	/**
	 * @var string
	 * Date: 29/04/2018
	 * @author George
	 */
	protected $keyType = 'string';

	/**
	 * 获取权限信息
	 *
	 * Date: 29/04/2018
	 * @author George
	 * @return \Illuminate\Database\Eloquent\Relations\MorphOne
	 */
	public function permission()
	{
		return $this->morphOne(Permission::class, 'permissiontable');
	}
}
